



public class CorsMiddleware
{
    private readonly RequestDelegate _next;
    public CorsMiddleware(RequestDelegate next)
    {
        _next = next;
    }
    public async Task Invoke(HttpContext context)
    {
        if (!context.Response.Headers.ContainsKey("Access-Control-Allow-Orgin"))
        {
            context.Response.Headers.Add("Access-Control-Allow-Orgin","*");
            await _next(context);   
        }
    }
}